﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SilverlightDatabase.Client
{
    /// <summary>
    /// Event arguments for client/server WCF communications
    /// </summary>
    public class ClientResult : EventArgs
    {
        /// <summary>
        /// Database taht is received from the server
        /// </summary>
        public Database ServerDatabase { get; private set; }
        /// <summary>
        /// If true server operation completed successfully
        /// </summary>
        public bool ServerResult { get; private set; }
        /// <summary>
        /// WCF Error if any occur
        /// </summary>
        public Exception Error { get; private set; }
        /// <summary>
        /// User state data
        /// </summary>
        public object UserData { get; private set; }
        

        /// <summary>
        /// New instance of event argiments
        /// </summary>
        /// <param name="database">Database from the server</param>
        /// <param name="serverResult">If true server operation was successful</param>
        /// <param name="error">WCF error if any</param>
        /// <param name="userData">User state</param>
        public ClientResult(Database database, bool serverResult, Exception error, object userData)
        {
            ServerDatabase = database;
            ServerResult = serverResult;
            Error = error;
            UserData = userData;
        }
    }
}
